package com.prs.crm.domain.cdxh;

import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.OrderBy;
import javax.persistence.Table;

import org.hibernate.annotations.Cascade;

import com.prs.crm.domain.BaseEntity;

/**
 * @author LanXiaoGang
 * @E-mail:lan9liang@163.com
 * @qq:7857553326
 * @version 创建时间：2010-12-14 下午01:11:22 简单说明
 */
@Entity
@Table(name = "cdxh_AlreadyDistribution")
public class AlreadyDistribution extends BaseEntity {

	private static final long serialVersionUID = 1L;

	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	private Integer id;

	/**
	 * 配送单明细
	 */
	
	@OneToMany(mappedBy = "alreadyDistribution", fetch = FetchType.LAZY,cascade ={CascadeType.ALL})
	@OrderBy
	@Cascade({ org.hibernate.annotations.CascadeType.ALL,
			org.hibernate.annotations.CascadeType.DELETE_ORPHAN })
	private Set<AlreadyDistributionDtail> details;

	/**
	 * 订单编号
	 */
	private String planorderCode;

	/**
	 * 配送单编号
	 */
	private String distributionCode;
	/**
	 * 客户名称
	 */
	private String customerName;

	/**
	 * 登记日期
	 */
	private String registDate;

	/**
	 * 合计数量
	 */
	private String totalNums;
	/**
	 * 合计钱
	 * 
	 * @param detail
	 */
	private double totalMony;

	public void addDetail(AlreadyDistributionDtail detail) {
		if (details == null)
			details = new HashSet<AlreadyDistributionDtail>();
		detail.setAlreadyDistribution(this);
		details.add(detail);
	}

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public Set<AlreadyDistributionDtail> getDetails() {
		return details;
	}

	public void setDetails(Set<AlreadyDistributionDtail> details) {
		this.details = details;
	}

	public String getPlanorderCode() {
		return planorderCode;
	}

	public void setPlanorderCode(String planorderCode) {
		this.planorderCode = planorderCode;
	}

	public String getDistributionCode() {
		return distributionCode;
	}

	public void setDistributionCode(String distributionCode) {
		this.distributionCode = distributionCode;
	}

	public String getCustomerName() {
		return customerName;
	}

	public void setCustomerName(String customerName) {
		this.customerName = customerName;
	}

	public String getRegistDate() {
		return registDate;
	}

	public void setRegistDate(String registDate) {
		this.registDate = registDate;
	}

	public String getTotalNums() {
		return totalNums;
	}

	public void setTotalNums(String totalNums) {
		this.totalNums = totalNums;
	}

	public double getTotalMony() {
		return totalMony;
	}

	public void setTotalMony(double totalMony) {
		this.totalMony = totalMony;
	}


}
